//
//  ViewController.m
//  PBNavigation
//
//  Created by 裴波波 on 16/4/21.
//  Copyright © 2016年 裴波波. All rights reserved.
//

#import "ViewController.h"
#import "PBTwoViewController.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {

    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    //设置控制器标题
    self.title = @"第一个";
    //设置返回按钮颜色
    self.navigationController.navigationBar.tintColor = [UIColor redColor];
    //设置navigationBar背景色
    self.navigationController.navigationBar.barTintColor = [UIColor blueColor];
    //设置标题颜色
    NSDictionary * dict = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
    self.navigationController.navigationBar.titleTextAttributes = dict;
    //自定义返回 "这个控制器" 的 "返回按钮" 后面的控制器返回按钮依然是上一个控制器的标题
    UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithTitle:@"hello" style:UIBarButtonItemStylePlain target:self action:nil];
    self.navigationItem.backBarButtonItem = item;
    
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{

    PBTwoViewController * vc = [PBTwoViewController new];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
